package com.longge;

import java.util.Arrays;
import java.util.stream.Collectors;
import java.util.stream.IntStream;

public class OptimalDivision {

    public String optimalDivision(int[] nums) {
        if (nums.length == 1) return nums[0] + "";
        if (nums.length == 2) return nums[0] + "/" + nums[1];
        return IntStream.of(nums).boxed().map(String::valueOf)
                .collect(Collectors.joining("/"))
                .replaceFirst("/", "/(") + ")";
    }
}
